package com.sikaryofficial.qrcode.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : qinjinyuan
 * @desc : 任务类型枚举
 * @date : 2023/10/31 19:23
 */
@Getter
@AllArgsConstructor
public enum DownloadTaskTypeEnum {

    /**
     * 任务类型 :1-产品二维码
     */
    PRODUCT_QRCODE(1, "产品二维码"),
    ;
    private final Integer code;
    private final String desc;

    public static DownloadTaskTypeEnum getByCode(Integer code) {
        return Arrays.stream(DownloadTaskTypeEnum.values())
                .filter(downloadTaskStatusEnum -> Objects.nonNull(code) && code.equals(downloadTaskStatusEnum.getCode()))
                .findFirst().orElse(null);
    }

}
